package digital.store.springmvc.service;

import java.util.Collection;
import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import digital.store.springmvc.dao.CategoryDao;
import digital.store.springmvc.dao.CustomerDao;
import digital.store.tutorial.springmvc.model.Category;
import digital.store.tutorial.springmvc.model.Customer;

@Service
@Transactional
public class CustomerService {
    @Autowired
    private CustomerDao customerDao;
	    
    @Transactional
    public void saveOrUpdate(Customer customer) {
    	customerDao.saveOrUpdate(customer);
	}
	    
	@Transactional
	public void delete(Long id) {
		customerDao.delete(id);
	}
	    
	public Collection<Customer> findAll() {
	    return customerDao.findAll();
	}
	
	public Customer findById(Long id) {
	    return customerDao.findById(id);
	}
	
}
